var app = angular.module('myApp', []);

app.controller('userCenterController', function($rootScope,$scope,$http) {
    console.log("userCenterController()");

    $scope.upload = function() {
    	var url = $scope.getBasePath() + 'file/img/back_upload';
    	$http({
	        method : 'get',
	        url : url
	    }).
	    success(function(response) {
	    	console.log(url);
	        console.log(response);
	        console.log(response.data);
	    }).
	    error(function(response) {
	        console.log(response);
	    });

    };

    $scope.userId = getLocalUserID();

    function getLocalUserID() {
        var userId = localStorage.getItem('userId');

        if (!userId) {
            alert("您未登录,不能考试!");
            location.href = getBasePath() + "login";
            return ;
        }

        if (isNaN(userId)) {
            alert("用户ID数据错误,不能考试!请重新登录!");
            location.href = getBasePath() + "login";
            return ;
        }

        return userId;
    }

    $scope.getBasePath = globalPath.getBasePath;
});